package tests;
import java.io.IOException;

import mat.*;
import types.*;

public class testcase2 {
public static MDoc initdoc (  MDoc document ) {
document.fontSize = 20;
document.fontType = "New Times";
document.defaultdistance = 5;
return document;
}

public static void main (String[] arg) throws IOException {
 MDoc  mydoc = new MDoc() ;
 //Mat.addNode(mydoc);
  MLabel  ad = new MLabel() ;
 Mat.addNode(ad);
  MLabel[]  title = new MLabel[2] ;
  title[0] = new MLabel() ;
 Mat.addNode(title[0]);
  title[1] = new MLabel() ;
 Mat.addNode(title[1]);
  MLabel  intro = new MLabel() ;
 Mat.addNode(intro);
  MLabel  tent = new MLabel() ;
 Mat.addNode(tent);
  MLabel[]  titlesPath = new MLabel[2] ;
  titlesPath[0] = new MLabel() ;
 //Mat.addNode(titlesPath[0]);
  titlesPath[1] = new MLabel() ;
 //Mat.addNode(titlesPath[1]);
  MLabel[]  testPoly = new MLabel[6] ;
  testPoly[0] = new MLabel() ;
 Mat.addNode(testPoly[0]);
  testPoly[1] = new MLabel() ;
 Mat.addNode(testPoly[1]);
  testPoly[2] = new MLabel() ;
 Mat.addNode(testPoly[2]);
  testPoly[3] = new MLabel() ;
 Mat.addNode(testPoly[3]);
  testPoly[4] = new MLabel() ;
 Mat.addNode(testPoly[4]);
  testPoly[5] = new MLabel() ;
 Mat.addNode(testPoly[5]);
  MPic  picAtTopRight = new MPic() ;
 Mat.addNode(picAtTopRight);
  MPic  picAtDownLeft = new MPic() ;
 Mat.addNode(picAtDownLeft);
  int  i ;
  int  j ;
  int  dis ;
 mydoc = initdoc(mydoc);
 Mat.initMDoc(mydoc); // +++
ad.position_to = mydoc;
ad.content = "The world's greatest collection of card magic!\nby genii";
ad.direction = MDirection.INNERTOP;
ad.zaxis = 2;
titlesPath[0].content = "C:\\Temp\\test.txt";
titlesPath[1].content = "C:\\Temp\\test.txt";
for(i = 0;
 i < 2;
 i = i + 1)
{
title[i].position_to = mydoc;
title[i].content = Mat.text(titlesPath[i].content);
title[i].fontSize = mydoc.fontSize * 2;
title[i].zaxis = ad.zaxis;

}title[0].direction = MDirection.INNERMIDDLE;
title[1].position_to = title[0];
title[1].direction = Mat.from(MDirection.down,0);
picAtTopRight.position_to = mydoc;
picAtTopRight.direction = MDirection.INNERTOPRIGHT;
picAtTopRight.path = "C:\\Temp\\pic.jpeg";
picAtTopRight.zaxis = ad.zaxis;
intro.position_to = title[1];
intro.content = Mat.text("C:\\Temp\\test.txt");
intro.direction = Mat.from(MDirection.down,20);
intro.distance = 2 * mydoc.defaultdistance;
intro.zaxis = ad.zaxis;
tent.position_to = picAtTopRight;
tent.content = Mat.text("C:\\Temp\\test.txt");
tent.direction = Mat.degree(title[1],intro);
dis = 0;
for(i = 0;
 i < 6;
 i = i + 1)
{
for(j = 0;
 j < i;
 j = j + 1)
{
if(j == 0)
dis = dis + 1;
if(j == i - 1)
testPoly[i].fontSize = j + mydoc.fontSize;

}testPoly[i].zaxis = ad.zaxis - 1;

}testPoly[0].content = "M";
testPoly[1].content = "A";
testPoly[2].content = "G";
testPoly[3].content = "I";
testPoly[4].content = "C";
testPoly[5].content = "!";
dis = 50;
//dis = dis * Mat.distance(ad,intro);
Mat.poly(testPoly,6,picAtTopRight,dis,Mat.from(MDirection.right,45));
picAtTopRight.position_to = mydoc;
picAtTopRight.direction = MDirection.INNERMIDDLE;
picAtTopRight.path = "C:\\Temp\\pic.jpeg";
picAtTopRight.zaxis = ad.zaxis;


Mat.layout1();

}

}
